/*
package com.spsy.search.repository;

import com.alibaba.fastjson.JSON;
import org.elasticsearch.action.delete.DeleteRequest;
import org.elasticsearch.action.delete.DeleteResponse;
import org.elasticsearch.action.get.GetRequest;
import org.elasticsearch.action.get.GetResponse;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

*/
/**
 * @author: liuzhiping
 * @date: 2024/11/29 11:47
 **//*


@Component
public class EntityRepositoryWrapper {

    @Autowired
    private RestHighLevelClient restHighLevelClient;

    String add(IndexRequest indexRequest) throws  Exception{
        IndexResponse indexResponse = this.restHighLevelClient.index(indexRequest, RequestOptions.DEFAULT);
        System.out.println("status:"+indexResponse.status().getStatus());

        return "success";
    }

    String del(DeleteRequest deleteRequest) throws Exception{
        DeleteResponse response = this.restHighLevelClient.delete(deleteRequest,RequestOptions.DEFAULT);
        System.out.println("status:"+response.status().getStatus());
        Thread.sleep(2000);
        return "success";
    }


    Map<String,Object> get(GetRequest getRequest) throws Exception{
        GetResponse response = this.restHighLevelClient.get(getRequest,RequestOptions.DEFAULT);
        return response.getSource();
    }



}
*/
